import HttpService from "@/api";
import type { CodeResponse, LoginForm, LoginResponse } from "@/typings";

/**
 * @description 登录
 * @param params 登录数据
 */
// export const login = (userForm: LoginForm) => HttpService.post<LoginResponse>("/user/login", userForm);
export const login = (userForm: LoginForm) => HttpService.post<LoginResponse>("/Users/login", userForm);

// 注册
export const register = (userForm: LoginForm) => HttpService.post<LoginResponse>("/Users", userForm);

// 更新用户信息
export const updateUser = (id: number) => HttpService.put<LoginResponse>("/Users/" + id, { isNew: false });

/**
 * @description 获取验证码
 * @returns
 */
export const getCode = () => HttpService.get<CodeResponse>("/user/code");
